{% if node.has_role %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <span style="font-weight: bold">角色配置信息</span>
            &nbsp;&nbsp;&nbsp;
                <a data-toggle="modal" data-target="#Modal{{ node.nid }}">
                    <i class="glyphicon glyphicon-plus" title="添加"></i>
                </a>
            <a style="float:right;" href="/flow/">
                <i class="glyphicon glyphicon-th" title="首页"></i>
            </a>
        </div>
        <div class="panel-body">
            <div class="modal fade" id="Modal{{ node.nid }}" tabindex="-1" role="dialog"
                 aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <form action="/flow/create_node_config/{{ node.nid }}"
                              method="POST">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"
                                        aria-hidden="true">
                                    &times;
                                </button>
                                <h4 class="modal-title">添加角色</h4>
                            </div>
                            <div class="modal-body">
                                    <select name='rid' class="form-control">
                                        {% for item in roles %}
                                            <option value="{{ item.rid }}">{{ item.name }}</option>
                                        {% endfor %}
                                    </select>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default"
                                        data-dismiss="modal">
                                    关闭
                                </button>
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>

            {% if node.configs %}
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>角色</th>
                        <th>启用状态</th>
                        <th>创建人</th>
                        <th>创建日期</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for item in node.configs %}
                        <tr>
                            <td>{{ item.id }}</td>
                            <td><a href="/role_map/{{ item.role.rid }}">{{ item.role.name }}</a></td>
                            <td>
                                {% if item.enabled %}
                                    <a href="/flow/update_node_config_enabled/{{ item.id }}">
                                                        <span class="glyphicon glyphicon-ok-circle"
                                                              style="color: blue;font-size: 20px"></span> </a>
                                {% else %}
                                    <a href="/flow/update_node_config_enabled/{{ item.id }}">
                                                        <span class="glyphicon glyphicon-ban-circle"
                                                              style="color: red;font-size: 20px"></span> </a>
                                {% endif %}
                            </td>
                            <td>{% if item.create_uid != None %}{{ item.create_user.name }} {% else %}- {% endif %} </td>
                            <td>{{ item.create_date }}</td>
                            <td style="text-align: center">
                                <a href="/flow/delete_node_config/{{ item.id }}">
                                    <i class="glyphicon glyphicon-remove-circle"
                                       title="删除"></i>
                                </a>
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% else %}
                <div class="jumbotron">
                    <h3>没有配置信息</h3>
                    <p>&nbsp;</p>
                        <p><a class="btn btn-primary btn" href="/car_form/None"
                              data-toggle="modal" data-target="#Modal{{ node.nid }}"
                              role="button">添加</a></p>
                </div>
            {% endif %}

        </div>
    </div>

{% endif %}